package com.xm9m.ibczy.dsp.views;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;

import com.xm9m.ibczy.dsp.R;
import com.xm9m.ibczy.dsp.beans.AndoIntoBean;

/**
 * Created by baichuan on 2016/11/28.
 */

public class SingleImgView extends BaseView {

    private TextView title;
    private ImageView img;

    public SingleImgView(Context context) {
        super(context);
        initThisView(context, null, 0);
    }

    public SingleImgView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initThisView(context, attrs, 0);
    }

    public SingleImgView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initThisView(context, attrs, defStyleAttr);
    }

    @Override
    public void initThisView(Context context, AttributeSet attrs, int defStyleAttr) {
        view = LayoutInflater.from(context).inflate(R.layout.avia_big_img1, this, true);
        title = (TextView) view.findViewById(R.id.advier_item_title);
        img = (ImageView) view.findViewById(R.id.advier_item_image);
    }

    @Override
    public void bindView() {

        AndoIntoBean.AdsBean adsBean = bean.getAds().get(0);
        if (adsBean == null)
            return;
        title.setText(adsBean.getTitle());
        String s = adsBean.getImage_urls().get(0);
        if (s != null)
            setImage(img, s);
    }

}
